package com.kafka.logs.service;

import lombok.extern.log4j.Log4j2;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.context.annotation.PropertySource;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;

@Log4j2
//@Service
@PropertySource(value = "classpath:kafka.properties")
public class KafkaLogService {

    @KafkaListener(topics = {"exception-handler-topic"})
    public void KafkaConsumer(ConsumerRecord message){
        log.info(String.format("offset = %d, topic = %s, value = %s", message.offset(), message.topic(), message.value()));
    }
}
